{extend name="ashippingguide/Public/base" /}
{block name="container"}
<script>
    $(function () {
        $('#uploadify').uploadifive({
            'buttonText': '附件',
            'width': '50px',
            'height': '30px',
            'fileObjName': "bx_fy2",
            'queueID': "uploadifyQueue",
            'queueSizeLimit': 15,//这里我只允许单个图片上传
            'uploadScript': '{:url("ashippingmanagement2/uploadifive")}',
            'onUploadComplete': function (file, data) {
                data = JSON.parse(data);
                if (data.success) {
                    var dataValue = JSON.stringify(data.data);
                    file.queueItem.attr('uri', dataValue);
                } else {
                    file.queueItem.addClass('error');
                    file.queueItem.find('.fileinfo').html('-' + data.message);
                }
            }
        });
    })
</script>
<div class="page-heade">
    <h2 class="title_color text-center">修改导购离职申请</h2>
</div>
<form action="{:url('ashippingguide/quitguide')}" class="form-inline" method="post" id="form_id">
    <table class="table-bordered table" style="margin-bottom: 0;margin-top:5px">
        <tr>
            <!--导购用户id-->
            <input type="hidden" value="{$data.id}" name="id" id="id">
            <td class="text-center" style="min-width: 130px;width: 130px">申请人</td>
            <input type="hidden" name="applicant" value="{$user}" id="applicant">
            <td><a href="javascript:;">{$user}</a></td>
            <td  class="text-center" style="min-width: 130px;width: 130px">填写时间</td>
            <input type="hidden" name="fillintime" value='{:date("Y-m-d H:i:s")}' id="fillintime">
            <td colspan="3">{:date("Y-m-d H:i:s")}</td>
        </tr>
        <tr>
            <td class="text-center">所属网点分区</td>
            <td>{$data.yq}</td>
            <td class="text-center">所属网点省份</td>
            <td>{$data.ys}</td>
            <td class="text-center">所属网点城市</td>
            <td>{$data.yshi}</td>
        </tr>
        <tr>
            <td class="text-center">经销商名称</td>
            <td>{$data.jxs}</td>
            <td class="text-center">网点编号</td>
            <td>{$data.wd_no}</td>
            <td class="text-center">系统名称</td>
            <td>{$data.xt}</td>
        </tr>
        <tr>
            <td class="text-center">主网点标准名称</td>
            <td colspan="3"><a href="/index/net/view/?id={$data.wd_id}">{$data.wd}</a></td>
            <td class="text-center">导购员姓名</td>
            <input type="hidden" value="{$data.name}" id="name" name="name">
            <td>{$data.name}</td>
        </tr>
        <tr>
            <td class="text-center">更多所属网点</td>
            <td colspan="5">{$data.otherNet}</td>
        </tr>
        <tr>
            <td class="text-center">岗位类型</td>
            <td>{$data.postType}</td>
            <td class="text-center">入职时间</td>
            <td>{$data.entryDate}</td>
            <td class="text-center">转正时间</td>
            <td>{$data.justDate}</td>
        </tr>
        <tr>
            <td class="text-center">性别</td>
            <td>{if condition="$data['sex'] == 0"}男{else/}女{/if}</td>
            <td class="text-center">身份证号码</td>
            <td>{$data.IDNo}</td>
            <td class="text-center">联系电话</td>
            <td>{$data.phone}</td>
        </tr>
        <tr>
            <td class="text-center">是否签订合同</td>
            <td colspan="5">{if condition="$data['signContract'] == 0"}否{else/}是{/if}</td>
        </tr>
        <tr>
            <td class="text-center">促销员类型</td>
            <td colspan="5">{if condition="$data['promoters'] == 0"}长期促销员{else/}临时促销员{/if}</td>
        </tr>
        <tr>
            <td class="text-center">目前状态</td>
            <td colspan="5">{$data.nowState}</td>
        </tr>
        <tr>
            <td colspan="6" style="padding: 1px">
                <table class="table table-bordered text-center" style="margin-bottom: 0">
                    <tr>
                        <td>人事类型</td>
                        <td>执行时间</td>
                        <td>原因</td>
                        <td>薪级</td>
                        <td>网点</td>
                        <td>岗位类型</td>
                    </tr>
                    {volist name="tingType" id="list"}
                    <tr>
                        <td>{$list.tingType}</td>
                        <td>{$list.okDate}</td>
                        <td>{$list.reason}</td>
                        <td>{$list.wd}</td>
                        <td>{$list.postType}</td>
                        <td>{$list.salaryLevel}</td>
                    </tr>
                    {/volist}
                </table>
            </td>
        </tr>
        <tr>
            <td class="text-center">备注</td>
            <td colspan="5">{$data.des}</td>
        </tr>
        <tr>
            <input type="hidden" value="{$data.quit_id}" id="quit_id" name="quit_id">
            <td class="text-center">离职生效日<span class="colorRed">*</span><br>(<span class="colorRed">指导购最后一天上班的"次日"</span>)</td>
            <td><input type="text" class="form-control layer-date date" id="quitDate" name="quitDate" value="{$data.quitDate}"></td>
            <td class="text-center">是否允许返聘</td>
            <td>
                <label for="yallow">
                    <input type="radio" name="fanPin" {if condition="$data['fanPin'] eq 1"}checked {/if} id="yallow" value="1">是
                </label>
                <label for="nallow">
                    <input type="radio" name="fanPin" {if condition="$data['fanPin'] eq 0"}checked {/if} id="nallow" value="0">否
                </label>
            </td>
            <td class="text-center">离职类型</td>
            <td>
                <label for="zqcizhi">
                    <input type="radio" name="quitType" {if condition="$data['quitType'] eq 0"}checked {/if} id="zqcizhi" value="0">自清辞职
                </label>
                <label for="jglz">
                    <input type="radio" name="quitType" {if condition="$data['quitType'] eq 1"}checked {/if} id="jglz" value="1">解雇离职
                </label>
                <label for="htdqlz">
                    <input type="radio" name="quitType" {if condition="$data['quitType'] eq 2"}checked {/if} id="htdqlz" value="2">合同到期离职
                </label>
            </td>
        </tr>
        <tr>
            <td class="text-center">离职原因及备注<span class="colorRed">*</span></td>
            <td colspan="5">
                <textarea name="quitDes" id="quitDes" style="width: 60%;height: 50px;resize: none;" class="form-control">{$data.quitDes}</textarea>
            </td>
        </tr>
    </table>
<div class="form-group white-bg" style="margin:20px 10px 20px 20px" id="upfileDiv">
    <input type="hidden" id="exampleInputFile" name="exampleInputFile">
    <input type="button" name="uploadify" value="{$data['name']}" id="uploadify">
    <div id="uploadifyQueue">
        {volist name="$uploadify" id="list"}
        <?php $list['path'] = str_replace('\\','/',$list['path']);?>
        <div class="uploadifive-queue-item complete showFile" uri='{$list.uri}'
             id="uploadifive-offerFile-file-{$key}">
            <a class="close close_url" id="" href="#">X</a>
            <div>
                                <span class="filename">
                                                <a onclick="visitfile('{$list.path}');">
                                                    {$list.file_name}
                                                </a>
                                </span>
            </div>
        </div>
        {/volist}
        <script>
            $('.close_url').click(function () {
                var paclose = $(this).parent('.showFile');
                paclose.hide(300, function () {
                        paclose.remove();
                    }
                );
            });

            function visitfile(file) {
                var exts = file.split(".");
                var ext = exts[1];
                var files = file.split("/");
                var filename = files[4];
                if (ext == "jpg" || ext == "png" || ext == "gif" || ext == "jpeg") {
                    window.open(file, '_blank');
                } else {
                    window.open("/index/Ashippingmanagement/downFile?path=" + file, '_self');
                }
            }

        </script>
    </div>
    <p class="help-block" style="color:#1295d2">注：最多上传15个文件，每个文件小于50M,支持格式：</p>
    <p class="help-block" style="color:#1295d2">
        jpg,bnp,gif,png,jpeg,tif,raw,doc,docx,xls,xlsx,ppt,pptx,txt,pdf,rar,zip,mp4,avi,rmvb,rm,mid,3gp,AVI,3GP,,mpg,mp3,wma,wav</p>
</div>
<div class="padding-10 text-center">
    <input type="hidden" name="isdraft" id="isdraft" value="">
    <input type="button" class="btn btn-primary" onclick="primary(0)" value="保存为草稿"/>
    <input type="button" class="btn btn-warning" onclick="primary(1)"  value="保存修改并提交"/>
    <input type="button" class="btn btn-info"  onclick="back()" value="返回"/>
</div>
</form>
<script>
    lay('.date').each(function () {
        laydate.render({
            elem: this
            , trigger: 'click'
        });
    });
    function back(){
        history.go(-1)
    }
    function primary(type) {
        var enclosure_url = '';
        $('form').find('#uploadifyQueue .uploadifive-queue-item').each(function () {
            if ($(this).attr('uri')) {
                if (enclosure_url == '') {
                    enclosure_url += $(this).attr('uri');
                } else {
                    enclosure_url += "||" + $(this).attr('uri');
                }
            }
        });
        $('#exampleInputFile').val(enclosure_url);
        $('#isdraft').val(type);
        // 获取下所有网点（50个）
        $('#form_id').submit();
    }
</script>
{/block}
